﻿@using Dignite.Abp.Data;
@using Dignite.Cms.Public.Web.Models;

@model EntryViewModel
@{
    PageLayout.Content.Title = Model.Entry.GetField<string>("title");

    //current category
    var category = Context.Request.Query["category"].ToString();
    IList<QueryingByField> parameters = null;
    if (!category.IsNullOrWhiteSpace())
    {
        parameters = new List<QueryingByField>
        {
            new QueryingByField("BlogCategory",category)
        };
    }

    //current paging number
    int currentPage;
    if (!int.TryParse(Context.Request.Query["currentPage"], out currentPage))
    {
        currentPage = 1;
    }

}
@section content_toolbar {
    <partial name="blog/_blog-toolbar" model="Model"></partial>
}
<h1 class="fs-1 text-primary fw-semibold my-5">
    <cms-entry-field field-name="title" entry="Model"></cms-entry-field>
</h1>
<cms-entry-list 
                section-name="blog-post"
                current-page="currentPage"
                max-result-count="20" 
                culture="@Model.Entry.Culture" 
                querying-by-fields="parameters"
                partial-name="blog/_post-list">
</cms-entry-list>